import Taro from '@tarojs/taro-rn';
import * as tslib_1 from "tslib";
import React from 'react';
import { Component } from "@tarojs/taro-rn";
import { View, CoverView, Image, Text, RichText } from "@tarojs/components-rn";
import { toJS } from 'mobx';
import { inject, observer } from "@tarojs/mobx-rn";
import { getRuntime } from "../../utils/common";
import welfare_record_detailStyleSheet from "./welfare_record_detail_styles";
import banner_03 from '../../assets/img/banner_03.jpg';
import icon_03_on from '../../assets/img/icon_03_0n.png';
var _styleSheet = welfare_record_detailStyleSheet;
let Success = class Success extends Component {
  constructor(props) {
    super(props);
    this.state = {
      info: {}
    };
  }
  componentWillMount() {
    Taro.setNavigationBarTitle({ title: '公益详情' });
    let id = this.$router.params.id;
    this.getPublicWelfareInfo(parseInt(id));
  }
  getPublicWelfareInfo(id) {
    let { PublicWelfareStore } = this.props.stores;
    PublicWelfareStore.getPublicWelfareInfo({
      formId: id,
      callback: res => {
        this.setState({
          info: toJS(res)
        });
      }
    });
  }
  handelRouter(url = '/pages/index/index') {
    getRuntime().navigateTo(url);
  }
  render() {
    let { info } = this.state;
    return <View style={_styleSheet["welfare-record-detail"]}>
        <Image src={banner_03} style={_styleSheet["header-pic"]} />

        <CoverView>
          <View style={_styleSheet["record-info"]}>
            <View style={[_styleSheet["r"], _styleSheet["l"]]}>
              <Image src={icon_03_on} style={_styleSheet["icon-a"]} />
             
              <View style={_styleSheet["desc-name"]}>
                <Text style={_styleSheet["desc"]}>救助人:</Text>
                <Text style={_styleSheet["name"]}>{info.name}</Text>
              </View>
              <View style={[_styleSheet["desc-name"], { paddingLeft: '20px' }]}>
                <Text style={_styleSheet["desc"]}>救助金额:</Text>
                <Text style={_styleSheet["list-small"]}>￥</Text>
                <Text style={_styleSheet["list-price"]}>{info.userAmountMoney}</Text>
              </View>
            </View>
          </View>
        </CoverView>

        <View style={_styleSheet["article"]}>
          <View style={_styleSheet["interval"]} />

          <View style={[_styleSheet["column-title"], _styleSheet["content-30"]]}>
            <Text style={_styleSheet["column-name"]}>捐助详情</Text>
          </View>

          <View style={_styleSheet["welfare-article"]}>
            <RichText nodes={info.description} style={_styleSheet["rich-text"]} />
          </View>

          <View style={_styleSheet["interval"]} />

          <View style={[_styleSheet["column-title"], _styleSheet["content-30"]]}>
            <Text style={_styleSheet["column-name"]}>救助说明</Text>
          </View>

          <View style={_styleSheet["welfare-article"]}>
            {info.introduce}
          </View>
        </View>

      </View>;
  }
};
Success = tslib_1.__decorate([inject("stores"), observer], Success);
export default Success;